//
//  Item.m
//  File Metager
//
//  Created by Aaron VonderHaar on 07-05-09.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import "Item.h"


@implementation Item

- (id)init
{
	notes = @"";
	[notes retain];
	
	filename = NULL;
	return self;
}

- (void)setFile:(NSString*)theFile
{
	[filename release];
	filename = [NSString stringWithString:theFile];
	[filename retain];
}

- (NSString*)getFilename
{
	if (filename == NULL) {
		return @"<No File>";
	} else {
		return filename;
	}
}

- (NSString*)getNotes
{
	return notes;
}

- (void)setNotes:(NSString*)theNotes
{
	[notes release];
	if (theNotes == nil) {
		notes = @"";
	}
	else
	{
		notes = [NSString stringWithString:theNotes];
	}
	[notes retain];
}

- (void)encodeWithCoder:(NSCoder *)coder
{
	[coder encodeObject:notes forKey:@"notes"];
	[coder encodeObject:filename forKey:@"filename"];
}

- (id)initWithCoder:(NSCoder *)coder
{
	[self setNotes:[coder decodeObjectForKey:@"notes"]];
	[self setFile:[coder decodeObjectForKey:@"filename"]];
	return self;
}

- (NSString *)description
{
	return [NSString stringWithFormat:@"<Item: %@>", filename];
}

@end
